package con.zzjson;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * <p>****************************************************************************</p>
 * <p><b>Copyright © 2010-2019 shuncom team All Rights Reserved<b></p>
 * <ul style="margin:15px;">
 * <li>Description : con.zzjson</li>
 * <li>Version     : 1.0.0</li>
 * <li>Creation    : 2019年09月11日</li>
 * <li>@author     : zzy0_0</li>
 * </ul>
 * <p>****************************************************************************</p>
 */
@RestController
@RequestMapping("/echo")
public class EchoServiceController {
	Random random = new Random();

	@GetMapping("/")
	public String test() {
		await();
		return "s";
	}

	private void await() {
		int i = random.nextInt(50);
		try {
			System.out.println(String.format("currentTHread =%s sleep %s", Thread.currentThread().getName(), i));
			Thread.sleep(i);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

}